package com.nekonomics
package api.dto.response

import domain.detail.SkuDetail
import types.Money

import zio.json.JsonEncoder

case class ProductDto(
  spuId: Long,
  name: String,
  skuId: Long,
  price: Money,
  stock: Int,
  isActive: Boolean,
  imageUrl: Option[String],

) derives  JsonEncoder


object ProductDto {
  def of(skuDetail: SkuDetail) = {
    ProductDto(
      spuId = skuDetail.spuId,
      name = skuDetail.name,
      skuId = skuDetail.id,
      price = skuDetail.price,
      stock = skuDetail.stock,
      isActive = skuDetail.isActive,
      imageUrl = skuDetail.imageUrl
    )
  }
  
  
}
